//
//  DKUnauthProductCell.m
//  DanKU
//
//  Created by 吴斌 on 2023/11/12.
//

#import "DKUnauthProductCell.h"

static NSString * DKUnauthProductCellId = @"DKUnauthProductCellId";
@interface DKUnauthProductCell()
@property (nonatomic, strong)UIImageView * productImgView;
@property (nonatomic, strong)UILabel * productBillLab;
@end
@implementation DKUnauthProductCell
+ (instancetype)unauthProductCell:(UITableView *)tableView{
    DKUnauthProductCell * dk_UnauthProductCell = [tableView dequeueReusableCellWithIdentifier:DKUnauthProductCellId];
    if (!dk_UnauthProductCell) {
        dk_UnauthProductCell = [[DKUnauthProductCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:DKUnauthProductCellId];
    }
    dk_UnauthProductCell.backgroundColor = [UIColor clearColor];
    dk_UnauthProductCell.selectionStyle = UITableViewCellSelectionStyleNone;
    dk_UnauthProductCell.accessoryType = UITableViewCellAccessoryNone;
    return dk_UnauthProductCell;
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self == [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self dk_addSubView];
    }
    return self;
}
- (void)dk_addSubView{
    self.productImgView = [[UIImageView alloc] init];
    self.productImgView.image = DK_GetImage(@"dk_MainBillBg");
    self.productImgView.userInteractionEnabled = YES;
    [self.contentView addSubview:self.productImgView];
    [self.productImgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.contentView);
        make.left.equalTo(@(DK_IsWidthScale(18)));
        make.height.equalTo(@(DK_IsWidthScale(18)));
        make.width.equalTo(@(DK_IsWidthScale(18)));
    }];
    UIImageView* productIconImgView = [[UIImageView alloc] init];
    productIconImgView.userInteractionEnabled = YES;
    productIconImgView.image = DK_GetImage(@"dk_MainBillIcon");
    [self.productImgView addSubview:productIconImgView];
    [productIconImgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.productImgView);
        make.centerX.equalTo(self.productImgView);
        make.width.equalTo(@(DK_IsWidthScale(12)));
        make.height.equalTo(@(DK_IsWidthScale(15)));
    }];
    
    self.productBillLab = [[UILabel alloc] init];
    self.productBillLab.textColor = DK_Hex(@"#333333");
    self.productBillLab.font = DK_FONT_Regular(13);
    [self addSubview:self.productBillLab];
    [self.productBillLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.productImgView.mas_right).offset(DK_IsWidthScale(10));
        make.centerY.equalTo(self.productImgView);
        make.height.equalTo(@(DK_IsWidthScale(18)));
    }];
    UIImageView * productBackImgView = [[UIImageView alloc] init];
    productBackImgView.userInteractionEnabled = YES;
    productBackImgView.image = DK_GetImage(@"dk_MainBillBack");
    [self.contentView addSubview:productBackImgView];
    [productBackImgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.contentView);
        make.right.equalTo(@(-DK_IsWidthScale(36)));
        make.height.equalTo(@(DK_IsWidthScale(18)));
        make.width.equalTo(@(DK_IsWidthScale(18)));
    }];
}
-(void)setOrderRecordListMdl:(DKOrderRecordListModel *)orderRecordListMdl{
    _orderRecordListMdl = orderRecordListMdl;
    if(_orderRecordListMdl){
//        [self.productImgView sd_setImageWithURL:[NSURL URLWithString:_orderRecordListMdl.slogan]];
        self.productBillLab.text = [NSString stringWithFormat:@"-₹%@",[NSString makeShowMoney:_orderRecordListMdl.repaymentDetail.repaymentAmount]];
    }
}
@end
